package com.tool.stock.entity;

/**
 * @author: 20231
 */

import lombok.Data;

/**
 * 单日股价
 * 1668,112,152,66
 * 最低,开盘,最高,收盘
 */
@Data
public class PriceBO {

    /**
     * 日期
     */
    private String date;

    /**
     * 最低价格
     */
    private int lowestPrice;

    /**
     * 开盘价格
     */
    private int openingPrice;

    /**
     * 最高价
     */
    private int maximumPrice;

    /**
     * 收盘价
     */
    private int closingPrice;

    /**
     * 涨幅
     */
    private int rise;

    /**
     * 五日均线
     */
    private float fiveAverage;

    /**
     * 拼装对象.
     *
     * @param prices
     */
    public PriceBO(int[] prices) {
        this.lowestPrice = prices[0];
        this.openingPrice = this.lowestPrice + prices[1];
        this.maximumPrice = this.lowestPrice + prices[2];
        this.closingPrice = this.lowestPrice + prices[3];

        this.rise = ((this.closingPrice - this.openingPrice) / this.openingPrice) * 100;
    }
}
